//package com.jc.dao.busi.impl;
//
//import com.jc.base.Assert;
//import com.jc.base.ComponentException;
//import com.jc.base.page.Page;
//import com.jc.base.ResultData;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import com.google.common.collect.Lists;
//import com.jc.dao.busi.SetConditionInfoDao;
//import com.jc.domain.busi.SetConditionInfoConditions;
//import com.jc.mapper.busi.SetConditionInfoMapper;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Repository;
//import org.springframework.transaction.annotation.Transactional;
//
//import com.jc.repository.generator.utils.GenerateMybaitsUtils;
//import com.jc.repository.generator.utils.Condition;
//import com.jc.repository.generator.utils.ConditionsExtend;
//import com.jc.utils.CollectionUtils;
//
//import java.util.List;
//import java.util.ArrayList;
//
///**
// * @author
// * @create 2016-12-13 09:32:26
// * @description
// */
//
//@Repository
//public class SetConditionInfoDaoImpl implements SetConditionInfoDao {
//
//    private static final Logger LOGGER = LoggerFactory.getLogger(SetConditionInfoDaoImpl.class);
//
//    @Autowired
//    private SetConditionInfoMapper mapper;
//
//    //this function automatic generated by application
//    @Override
//    public SetConditionInfo querySetConditionInfoById(Long id) {
//
//        Assert.notNull(id, "用于查询的id不能为空");
//        return mapper.selectByPrimaryKey(id);
//    }
//
//    //this function automatic generated by application
//    @Override
//    public ResultData<List<SetConditionInfo>> querySetConditionInfosByConditions(SetConditionInfo setConditionInfo, String orderByClause, Page page) {
//
//        ResultData<List<SetConditionInfo>> res = new ResultData<>();
//        if(null == setConditionInfo && LOGGER.isInfoEnabled()){
//            LOGGER.info("用于查询的条件为空, 将查询setConditionInfo表的所有数据");
//        }
//        SetConditionInfoConditions conditions = new SetConditionInfoConditions();
//
//        SetConditionInfoConditions.Criteria criteria = conditions.or();
//
//        GenerateMybaitsUtils.buildConditionsByReflect(criteria, setConditionInfo);
//
//        if (null != page) {
//            conditions.setPage(page);
//            page.setTotalNum(mapper.countByExample(conditions));
//            res.setPage(page);
//        }
//
//        if (null != orderByClause) {
//            conditions.setOrderByClause(orderByClause);
//        }
//
//        res.setData(mapper.selectByExample(conditions));
//        return res;
//    }
//
//    //this function automatic generated by application
//    @Override
//    public List<SetConditionInfo> querySetConditionInfosByConditions(SetConditionInfo setConditionInfo, String orderByClause){
//
//        if(null == setConditionInfo && LOGGER.isInfoEnabled()){
//        	LOGGER.info("用于查询的条件为空, 将查询setConditionInfo表的所有数据");
//        }
//        SetConditionInfoConditions conditions = new SetConditionInfoConditions();
//
//        SetConditionInfoConditions.Criteria criteria = conditions.or();
//
//        GenerateMybaitsUtils.buildConditionsByReflect(criteria, setConditionInfo);
//
//        if (null != orderByClause) {
//            conditions.setOrderByClause(orderByClause);
//        }
//
//        return mapper.selectByExample(conditions);
//    }
//
//    //this function automatic generated by application
//    @Override
//    public List<SetConditionInfo> querySetConditionInfosByConditionEx(SetConditionInfo setConditionInfo, String orderByClause, Condition condition) {
//
//        Assert.notNull(setConditionInfo, "用于查询的类,不能为空");
//        SetConditionInfoConditions conditions = new SetConditionInfoConditions();
//
//        SetConditionInfoConditions.Criteria criteria = conditions.or();
//        GenerateMybaitsUtils.buildConditionEx(criteria,setConditionInfo,condition);
//
//        if (null != orderByClause) {
//            conditions.setOrderByClause(orderByClause);
//        }
//
//        return mapper.selectByExample(conditions);
//
//    }
//
//    //this function automatic generated by application
//    @Override
//    public List<SetConditionInfo> querySetConditionInfosByConditionExs(ConditionsExtend conditionsExtend, String orderByClause) {
//        Assert.notNull(conditionsExtend, "用于查询的类,不能为空");
//        SetConditionInfoConditions conditions = new SetConditionInfoConditions();
//
//        SetConditionInfoConditions.Criteria criteria = conditions.or();
//
//        GenerateMybaitsUtils.buildConditionExs(criteria, conditionsExtend);
//
//        if (null != orderByClause) {
//            conditions.setOrderByClause(orderByClause);
//        }
//
//        return mapper.selectByExample(conditions);
//    }
//
//    //this function automatic generated by application
//    @Override
//    public SetConditionInfo saveOrInsert(SetConditionInfo setConditionInfo) {
//
//        Assert.notNull(setConditionInfo, "用于保存的对象不能为空");
//
//        GenerateMybaitsUtils.checkNotNull(setConditionInfo);
//
//        if (null != setConditionInfo.getId()) {
//            Assert.notNull(setConditionInfo.getId(), "用于更新的对象id不能为空");
//            mapper.updateByPrimaryKeySelective(setConditionInfo);
//        } else {
//            mapper.insertSelective(setConditionInfo);
//        }
//        return setConditionInfo;
//
//    }
//
//    //this function automatic generated by application
//    @Transactional
//    @Override
//    public List<SetConditionInfo> saveOrInsertList(List<SetConditionInfo> setConditionInfos) {
//
//        Assert.isTrue(CollectionUtils.isNotEmpty(setConditionInfos), "添加的setConditionInfo集合禁止为空");
//        ArrayList<SetConditionInfo> setConditionInfosSaved = Lists.newArrayListWithCapacity(setConditionInfos.size());
//
//        for (SetConditionInfo setConditionInfo:setConditionInfos) {
//            setConditionInfosSaved.add(saveOrInsert(setConditionInfo));
//        }
//        return setConditionInfosSaved;
//    }
//
//    //this function automatic generated by application
//    @Override
//    public boolean deleteSetConditionInfoById(Long id) {
//
//        Assert.notNull(id, "属性id不能为空");
//        boolean result = false;
//        try {
//             result =  mapper.deleteByPrimaryKey(id) > 0;
//        } catch (Exception e) {
//            throw new ComponentException(ComponentException.ErrCode.系统异常,"插入异常");
//        }
//        return result;
//    }
//
//    //this function automatic generated by application
//    @Override
//    public void deleteByConditions(SetConditionInfo setConditionInfo) {
//        Assert.notNull(setConditionInfo, "构造删除条件的类不能为空");
//
//        SetConditionInfoConditions conditions = new SetConditionInfoConditions();
//
//        SetConditionInfoConditions.Criteria criteria = conditions.or();
//
//        GenerateMybaitsUtils.buildConditionsByReflect(criteria,setConditionInfo);
//        mapper.deleteByExample(conditions);
//
//    }
//
//
//}